package com.ruoyi.qiju.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.qiju.domain.AlgsEquipmentApplication;
import com.ruoyi.qiju.service.IAlgsEquipmentApplicationService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 实验器材申请Controller
 * 
 * @author ruoyi
 * @date 2023-03-21
 */
@RestController
@RequestMapping("/qicaishenqing")
public class AlgsEquipmentApplicationController extends BaseController
{
    @Autowired
    private IAlgsEquipmentApplicationService algsEquipmentApplicationService;

    /**
     * 查询实验器材申请列表
     */
<<<<<<< HEAD
=======

>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
//    @RequiresPermissions("qiju:qicaishenqing:list")
    @GetMapping("/list")
    public TableDataInfo list(AlgsEquipmentApplication algsEquipmentApplication)
    {
        startPage();
        List<AlgsEquipmentApplication> list = algsEquipmentApplicationService.selectAlgsEquipmentApplicationList(algsEquipmentApplication);
        return getDataTable(list);
    }

    /**
     * 导出实验器材申请列表
     */
<<<<<<< HEAD
//    @RequiresPermissions("qiju:qicaishenqing:export")
    @Log(title = "实验器材申请", businessType = BusinessType.EXPORT)
=======

//    @RequiresPermissions("qiju:qicaishenqing:export")
//    @Log(title = "实验器材申请", businessType = BusinessType.EXPORT)

>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
    @PostMapping("/export")
    public void export(HttpServletResponse response, AlgsEquipmentApplication algsEquipmentApplication)
    {
        List<AlgsEquipmentApplication> list = algsEquipmentApplicationService.selectAlgsEquipmentApplicationList(algsEquipmentApplication);
        ExcelUtil<AlgsEquipmentApplication> util = new ExcelUtil<AlgsEquipmentApplication>(AlgsEquipmentApplication.class);
        util.exportExcel(response, list, "实验器材申请数据");
    }

    /**
     * 获取实验器材申请详细信息
     */
//    @RequiresPermissions("qiju:qicaishenqing:query")
    @GetMapping(value = "/{equipmentApplicationId}")
    public AjaxResult getInfo(@PathVariable("equipmentApplicationId") Long equipmentApplicationId)
    {
        return success(algsEquipmentApplicationService.selectAlgsEquipmentApplicationByEquipmentApplicationId(equipmentApplicationId));
    }

    /**
     * 新增实验器材申请
     */
<<<<<<< HEAD
//    @RequiresPermissions("qiju:qicaishenqing:add")
    @Log(title = "实验器材申请", businessType = BusinessType.INSERT)
=======

//    @RequiresPermissions("qiju:qicaishenqing:add")
//    @Log(title = "实验器材申请", businessType = BusinessType.INSERT)
>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
    @PostMapping
    public AjaxResult add(@RequestBody AlgsEquipmentApplication algsEquipmentApplication)
    {
        return toAjax(algsEquipmentApplicationService.insertAlgsEquipmentApplication(algsEquipmentApplication));
    }

    /**
     * 修改实验器材申请
     */
<<<<<<< HEAD
//    @RequiresPermissions("qiju:qicaishenqing:edit")
    @Log(title = "实验器材申请", businessType = BusinessType.UPDATE)
=======

//    @RequiresPermissions("qiju:qicaishenqing:edit")
//    @Log(title = "实验器材申请", businessType = BusinessType.UPDATE)
>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
    @PutMapping
    public AjaxResult edit(@RequestBody AlgsEquipmentApplication algsEquipmentApplication)
    {
        return toAjax(algsEquipmentApplicationService.updateAlgsEquipmentApplication(algsEquipmentApplication));
    }

    /**
     * 删除实验器材申请
     */
<<<<<<< HEAD
//    @RequiresPermissions("qiju:qicaishenqing:remove")
    @Log(title = "实验器材申请", businessType = BusinessType.DELETE)
=======

//    @RequiresPermissions("qiju:qicaishenqing:remove")
//    @Log(title = "实验器材申请", businessType = BusinessType.DELETE)
>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
	@DeleteMapping("/{equipmentApplicationIds}")
    public AjaxResult remove(@PathVariable Long[] equipmentApplicationIds)
    {
        return toAjax(algsEquipmentApplicationService.deleteAlgsEquipmentApplicationByEquipmentApplicationIds(equipmentApplicationIds));
    }

<<<<<<< HEAD
//    @RequiresPermissions("qiju:qicaishenqing:addE")
    @Log(title = "实验器材申请", businessType = BusinessType.INSERT)
=======
//
//    @RequiresPermissions("qiju:qicaishenqing:addE")
//    @Log(title = "实验器材申请", businessType = BusinessType.INSERT)
>>>>>>> eb024a4b1f6262b165cf5de5f3e86c584e961807
    @PostMapping("/{equipmentApplicationIds}")
    public AjaxResult addE(@PathVariable Long equipmentApplicationIds)
    {
        return toAjax(algsEquipmentApplicationService.addE(equipmentApplicationIds));
    }
}
